C# 自訂義搜尋控件


使用這個方法就可以更方便的搜尋需要的Controls

// 遞迴尋找控制項的方法
private Control FindControlByName(Control parentControl, string name)
{
    if (parentControl.Name == name)
    {
        return parentControl;
    }

    foreach (Control childControl in parentControl.Controls)
    {
        Control targetControl = FindControlByName(childControl, name);
        if (targetControl != null)
        {
            return targetControl;
        }
    }

    return null;
}
#C# #Winform







你可能感興趣的文章

一般業界數位IC設計開發流程

一般業界數位IC設計開發流程

CDS2019 Next-generation web styling 整理介紹

CDS2019 Next-generation web styling 整理介紹

金魚系列,淺談如何學習 css

金魚系列,淺談如何學習 css






留言討論